using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Hostal.Bussines.Entities;

namespace Hostal.Bussines.Repository.Mapping
{
    public class BoletaMap : EntityTypeConfiguration<Boleta>
    {
        public BoletaMap()
        {
            // Primary Key
            this.HasKey(t => t.IdBoleta);

            // Properties
            this.Property(t => t.IdBoleta)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("Boleta");
            this.Property(t => t.IdBoleta).HasColumnName("IdBoleta");
            this.Property(t => t.Cliente_Id).HasColumnName("Cliente_Id");
            this.Property(t => t.Fecha).HasColumnName("Fecha");
            this.Property(t => t.NBoleta).HasColumnName("NBoleta");
            this.Property(t => t.Total).HasColumnName("Total");

            // Relationships
            this.HasRequired(t => t.Huesped)
                .WithMany(t => t.Boletas)
                .HasForeignKey(d => d.Cliente_Id);

        }
    }
}
